package cuit.epoch.pymjl.security.mapper;

import cuit.epoch.pymjl.security.common.constant.ResultEnum;
import cuit.epoch.pymjl.security.entity.Resource;
import cuit.epoch.pymjl.security.entity.Roles;
import cuit.epoch.pymjl.security.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cuit.epoch.pymjl.security.entity.dto.UserDTOuserIdAnduseravatarUrl;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author Pymjl
 * @since 2022-08-20
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {
    /**
     * 得到用户的角色列表
     *
     * @param userId 用户id
     * @return {@code List<Roles>}
     */
    List<Roles> getUserRoles(@Param("userId") Long userId);

    /**
     * 获取用户资源
     *
     * @param roleId 角色id
     * @return {@code List<Resource>}
     */
    List<Resource> getUserResources(@Param("roleId") Long roleId);

    Object selectByEmail(@Param("email") String email);

//    boolean updateavatar(String username , byte [] avatar);

//插入用户头像
//    int updateUserAvatar(Map<String, byte[]> map);
}
